package com.farm.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.farm.service.NameTelservice;
import com.farm.utils_all.HUtil;

@Controller
public class NameTelController {

	@Autowired
	private NameTelservice nameTelservice;
	
	//查询全部学生信息和就餐地点
		@ResponseBody
		@RequestMapping("/selectAll.do")
		public Map selectAll(@RequestParam Map<String,Object> map,HttpServletRequest request) {
			List<Map<String, Object>> selectAll = nameTelservice.selectAll(map);
			if(selectAll == null && "".equals(selectAll)) {
				return HUtil.putInMap("code",1,"msg","姓名或电话输入错误，请重新输入！");
			}
			map.put("info", selectAll);
			return map;
		} 
	
	//查询学生信息和就餐地点
	@ResponseBody
	@RequestMapping("/selectNameTel.do")
	public Map articleArray(@RequestParam Map<String,Object> map,HttpServletRequest request) {
		Map<String, Object> selectNameTel = nameTelservice.selectNameTel(map);
		if(selectNameTel == null && "".equals(selectNameTel)) {
			return HUtil.putInMap("code",1,"msg","姓名或电话输入错误，请重新输入！");
		}
		return selectNameTel;
	} 

}
